<template>
    <div>
    <el-card class="box-card font-left">
        <div slot="header" class="clearfix">
            <span>创建文章</span>
        </div>
        <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="标题">
                <el-input v-model="form.Tile"></el-input>
            </el-form-item>
            <el-form-item label="副标题">
                <el-input v-model="form.SimpleTile"></el-input>
            </el-form-item>
            <el-form-item label="关键词">
                <el-input v-model="form.KeyWords"></el-input>
            </el-form-item>
            <el-form-item label="摘要">
                <el-input v-model="form.Abstract"></el-input>
            </el-form-item>
            <el-form-item label="来源" >
                <el-input v-model="form.Source" ></el-input>
            </el-form-item>           
            <el-form-item label="创建人" >
                <el-input v-model="form.Creater" readonly></el-input>
            </el-form-item>
            <el-form-item label="创建时间">
                <el-col :span="11">
                    <el-date-picker type="date" placeholder="选择日期" v-model="form.Date1" style="width: 100%;"></el-date-picker>
                </el-col>
            </el-form-item>
            <el-form-item label="文章内容">
                <el-input type="textarea" v-model="form.Content"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit(form)">立即创建</el-button>
                <el-button>取消</el-button>
            </el-form-item>
        </el-form>
        </el-card>
    </div>
</template>

<script>
    export default {
        data() {
        return {
            form: {
                Tile: '',
                SimpleTile:'',
                Abstract:'',
                KeyWord:' ',
                Source:'',
                Creater: this.$store.state.userInfo.count,
                Date1: '',
                Content:'',
                UID:this.$store.state.userInfo.UID
            }
        }
        },
        methods: {
            onSubmit(form) {
                console.log(form)
                this.$axios.post("/Artical/addArtical",form).then(res=>{
                    const result = res.data.d;
                    if(result.status==false){
                        return this.$message.error(result.message)
                    }
                    this.$message.success(result.message)
                })
            }
            
        }
    }
</script>

<style scoped>
    .box-card{
        margin: 5% 10%
    }
    .font-left{
        text-align:left;
        font-weight:bold
    }
</style>